#!/usr/bin/env bash

LINUX_TOOLS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"

. "${LINUX_TOOLS_DIR}/utils/utils.sh"
. "${LINUX_TOOLS_DIR}/scripts/docker/docker.sh"
. "${LINUX_TOOLS_DIR}/scripts/other.sh"
. "${LINUX_TOOLS_DIR}/scripts/system/system.sh"

function main() {
  clear
  echo_line "系统基本信息-SystemInfo"
  os_info_main
  echo_line "LINUX_TOOLS"
  echo_menu "1. " "系统管理 ▶"
  echo_menu "2. " "Docker管理 ▶"
  echo_menu "95." "Mysql备份"
  echo_menu "96." "端口扫描"
  echo_menu "97." "下载JDK"
  echo_menu "99." "更新脚本"
  echo_menu "0. "  "退出"
  echo_line "LINUX_TOOLS"

  read -r -p "请输入要安装服务的编号(Select)：" input
  case $input in
  1)
    system_main
    exit
    ;;
  2)
    docker_main
    exit
    ;;
  95)
    mysql_backup
    exit
    ;;
  96)
    port_scanning
    exit
    ;;
  97)
    download_jdk
    ;;
  99)
    update_sh
    ;;
  0)
    echo -e "退出LINUX_TOOLS脚本"
    exit
    ;;
  *)
    clear
    echo_red "请输入正确的编号，ctrl+c退出"
    sleep 1s
    main
    ;;
  esac
}

# 启动脚本
main
